package sevensoft.结构型模式.装饰模式;

import lombok.*;

import javax.naming.spi.ObjectFactory;
import java.math.BigDecimal;

/**
 * 装饰器类
 */
@Getter
@Setter
public abstract class Garnish extends Food {




    private Food food;

    public Garnish(Food food,BigDecimal price, String desc) {
        super(price, desc);
        this.food=food;
    }

    @Override
    public BigDecimal cost() {
        return getPrice().add(getFood().cost());
    }

    @Override
    public String getDesc() {
        return super.getDesc()+getFood().getDesc();
    }
}
